package com.wcs.exam.controller.admin.req;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * Admin-考试-监控数据-阅卷-评阅完成-请求参数
 * </p>
 *
 * @author wcs
 * @since 2025-03-31
 */
@Getter
@Setter
@Accessors(chain = true)
@Schema(description = "Admin-考试-监控数据-阅卷-评阅完成-请求参数")
public class AdminExamDataEvaluationEndReq implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "resource.exam.data.record.id.not.null")
    @Schema(description = "记录ID", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long recordId;

    @Valid
    @NotNull(message = "resource.exam.data.evaluation.result.not.null")
    @Size(min = 1, message = "resource.exam.data.evaluation.result.not.null")
    @Schema(description = "评阅结果", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<EvaluationResult> results;

    @Data
    public static class EvaluationResult implements Serializable {

        @Serial
        private static final long serialVersionUID = 3173191415689946206L;

        @NotNull(message = "resource.exam.data.answer.id.not.null")
        @Schema(description = "用户答案ID", requiredMode = Schema.RequiredMode.REQUIRED)
        private Long answerId;

        @DecimalMin(value = "0", message = "resource.exam.data.user.score.min.limit.error")
        @NotNull(message = "resource.exam.data.user.score.not.null")
        @Schema(description = "用户得分", requiredMode = Schema.RequiredMode.REQUIRED)
        private BigDecimal userScore;

        @Size(max = 200, message = "resource.exam.data.evaluation.comment.length.max.limit.error")
        @Schema(description = "评语")
        private String evaluationComment;
    }

}
